import Service from "./http"

function userLogin(params) {
  //用户登录
  return Service({
    url: "/user/login",
    method: "post",
    data: params
  })
}
/*
机构管理接口
 */
function getOrgChildrenOrganizations(params) {
  //根据机构id查询子机构列表
  return Service({
    url: "/org/ChildrenOrganizations",
    method: "get",
    params: params
  })
}
function orgFindAll() {
  //获取所有机构
  return Service({
    url: "/org/findAll",
    method: "get"
  })
}
/*
    学生管理接口
*/
function studentFindAll(scId) {
  //根据学校查询该学校的所有学生
  return Service({
    url: `/${scId}/student/findAll`,
    method: "get"
  })
}

function studentDelete(scId) {
  //删除该所学校的学生
  return Service({
    url: `/${scId}/student/delete`,
    method: "get"
  })
}
function studentAdd(scId, params) {
  //根据学校添加学生
  return Service({
    url: `/${scId}/student/save`,
    method: "post",
    data: params,
    headers: {
      "Content-Type": "application/json"
    }
  })
}
function studentUpdata(scId, params) {
  //根据学校添加学生
  return Service({
    url: `/${scId}/student/update`,
    method: "post",
    data: params,
    headers: {
      "Content-Type": "application/json"
    }
  })
}

function studentKeyword(scId, params) {
  //根据关键字查询学生
  return Service({
    url: `/${scId}/student/keyword`,
    method: "get",
    params: params
  })
}

/*
职工管理接口
 */
function empFindAll(scId) {
  //获取所有的职工
  return Service({
    url: `/${scId}/emp/findAll`,
    method: "get"
  })
}

function empSava(scId, pamras) {
  //添加员工
  return Service({
    url: `/${scId}/emp/save`,
    method: "post",
    data: pamras
  })
}
function empFindByCondition(scId, params) {
  //根据条件查询职工
  return Service({
    url: `/${scId}/emp/findByCondition`,
    method: "get",
    params: params
  })
}

/*
角色管理接口
 */
function roleFindAll() {
  //获取所有职位/角色
  return Service({
    url: `/role/findAll`,
    method: "get"
  })
}

/*
班级管理接口
 */
function classFindAll(scId) {
  //查询所有班级
  return Service({
    url: `/${scId}/class/findAll`,
    method: "get"
  })
}

/*
用户管理接口
 */
function userFinAll() {
  //查询所有用户
  return Service({
    url: "/user/findAll",
    method: "get"
  })
}
function userDelete(uid) {
  //根据uid删除用户
  return Service({
    url: `/user/delete/${uid}`,
    method: "get"
  })
}
function userAdd(params) {
  //根据uid删除用户
  return Service({
    url: `/user/add`,
    method: "post",
    data: params
  })
}

/*
视频监控接口
 */
function videoWall(scId) {
  return Service({
    url: `/${scId}/video/wall`,
    method: "get"
  })
}
export default {
  userLogin,

  getOrgChildrenOrganizations,
  orgFindAll,

  studentFindAll,
  studentDelete,
  studentKeyword,
  studentAdd,
  studentUpdata,

  empFindAll,
  empSava,
  empFindByCondition,

  classFindAll,

  roleFindAll,

  userFinAll,
  userDelete,
  userAdd,

  videoWall
}
